extends archetypes/content-with-menu.pug

include mixins/nav.pug

include mixins/documentationjs/description.pug
include mixins/documentationjs/type.pug
include mixins/documentationjs/struct.pug
include mixins/documentationjs/method.pug
include mixins/documentationjs/event.pug
include mixins/documentationjs/instantsearch-usage.pug

block navigation
  - const headings = [ {tag: 'h2', id: 'description', text: 'Description'}, {tag: 'h2', id:'usage', text:'Usage'}, {tag: 'h2', id:'options', text:'Options'}, {tag: 'h2', id:'methods', text:'Methods'}, {tag: 'h2', id:'events', text: 'Events'}]
  +nav(navPath, navigation, mainTitle || title, headings)

block content
  h2#description Description
    a.anchor(href=`${navPath}#description`)
  p
    +description(instantsearchFactory.description)
  h2#usage Usage
    a.anchor(href=`${navPath}#usage`)
  +instantsearchUsage(instantsearchFactory)

  h2#options Options
    a.anchor(href=`${navPath}#options`)
  each t in instantsearchFactory.relatedTypes
    if t
      +struct(t, instantsearchFactory.relatedTypes)
  h2#methods Methods
    a.anchor(href=`${navPath}#methods`)
  each m in InstantSearch.members.instance
    if m
      +method(m, instantsearchFactory.relatedTypes)
  h2#events Events
    a.anchor(href=`${navPath}#events`)
  p InstantSearch is an EventEmitter and as such it emits events on specific parts of the lifecycle.
  h3 render
  p
    | Triggered when the rendering of all the widgets is done. This
    | happens after a search result comes back from Algolia - which means that it is
    | triggered for the first time once everything after all the widgets went through all
    | there lifecycle steps once (getConfiguration, init, render).
  h3 error
  p
    | Triggered when an error is reported when calling the API.
